#!/bin/sh

dockerid=`docker ps -a --no-trunc --filter name=web-openresty | grep -v CONTAINER | awk '{print $1}'`

if [[ -n "$dockerid" ]]; then
    docker stop $dockerid && docker rm $dockerid
fi

docker run -d --name web-openresty \
-v /opt/web-server/static/dist:/opt/web-server/static/dist \
-v /opt/web-server/static/house:/opt/web-server/static/house \
-v /opt/web-server/static/admin:/opt/web-server/static/admin \
-v /opt/web-server/configs/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf \
-p 8022:80 \
--restart=always \
-m 2Gi \
--memory-reservation 128Mi \
--cpus 1 \
web-openresty:1.0
